package hackathon1212;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public final class GsonFactory {
	private GsonFactory() {
	}

	public static Gson get() {
		Gson gson = new GsonBuilder().serializeNulls()
				.setExclusionStrategies(new ExclusionStrategy() {
					@Override
					public boolean shouldSkipField(FieldAttributes f) {
						return null != f.getAnnotation(JsonSkip.class)
								|| f.getName() == "jdoDetachedState";
					}

					@Override
					public boolean shouldSkipClass(Class<?> c) {
						return false;
					}
				}).create();
		return gson;
	}
}